﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../../../fly/fly.js" type="text/javascript"></script>
    <script src="../../fly.ui.js" type="text/javascript"></script>
    <script src="../../plugins/grid/grid.js" type="text/javascript"></script>
    <link href="../../plugins/themes/blue/fly-base.css" rel="stylesheet" type="text/css" />
    <link href="../../plugins/themes/blue/grid.css" rel="stylesheet" type="text/css" />
    <script>
        $(function () {

            //generate data
            var rows = []
            while (rows.length < 200) {
                rows.push([
                    rows.length,
                    Math.random().toString(16).replace(/\d/g, ''),
                    Math.random(),
                    Math.random() + " - " + Math.random(),
                    Math.random(),
                    Math.random(),
                    Math.random()])
            }

            rows[0].children = [rows.pop(), rows.pop(), rows.pop(), rows.pop(), rows.pop()]

            rows[3].children = [rows.pop(), rows.pop()]

            rows[3].children[1].children = [rows.pop(), rows.pop()]

            //create store
            var store = new $.data.Store({
                records: rows
                //,remoteSort:true
            });

            //create grid
            var panel = new $.ui.grid.GridPanel({
                id: 'panel',
                store: store,
                altRowBy: 3,
                width: 800,
                height: 400,
                //showHeader: false,
                rowEvents: {
                    click: function (row, cell) {

                        alert("click: "+row.id)
                    }
                    //                    ,
                    //                    contextmenu: function (row) {
                    //                        alert("右键")
                    //                    },
                    //                    mouseup: function (row) {
                    //                        alert("鼠标")
                    //                    },
                    //                    keypress: function (row) {
                    //                        alert("键盘:"+$event.keyCode)
                    //                    }
                },
                plugins: new $.ui.grid.plugins.TreeGrid({
                    sm: {
                        parentCascade: true,
                        childCascade: true
                    }
                }),
                columns: [
                new $.ui.grid.RowNumberer({
                    format: "{0} in " + rows.length,
                    width: 150
                }),
                new $.ui.grid.CheckboxSelectionModel(),
                {
                    dataIndex: 0,
                    width: 40
                },
                {
                    dataIndex: 1
                }, 2, 3, 4]
            })
            panel.render(document.body)
        })
    </script>
    <style>
        body
        {
            background-image: url(../../plugins/themes/images/bgs.png);
            background-repeat: repeat-x;
            background-position: center bottom;
            height: 1000px;
            color: #222222;
            font-size: 12px;
            font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
        }
    </style>
</head>
<body>
</body>
</html>
